//
//  FoodDetailCell.swift
//  NeusoftSchool
//
//  Created by 张瑞 on 2017/5/2.
//  Copyright © 2017年 李狗蛋. All rights reserved.
//

import UIKit

class FoodDetailCell: UITableViewCell {


    @IBOutlet weak var telNum: UILabel!
    
    var phonenum: NSString!{
        willSet(newValue) {
            telNum.text = newValue as String;
        }
    }
    
    var food : ROFoodModel!{
        didSet(oldValue){
            let parmeters: NSDictionary = ["food_id":food.food_id]
            RONetworkMngTool.sharedNetwodkMngTool().RONetwork_GetShopbyFood(parmeters, view: UIView()) { (phonenum) in
                self.phonenum = phonenum
            }
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    @IBAction func makeCall(_ sender: UIButton) {
        print("telephone")
        //真机测试
        let url = NSURL(string: "tel://" + (phonenum as String
            ))
        UIApplication.shared.open(url! as URL, options:[:] , completionHandler: nil)
    }
    
    @IBAction func order(_ sender: UIButton) {
        print("1231")
        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "Order"), object: nil)
    }
    
    @IBAction func ollection(_ sender: UIButton) {
        print("4dsfsd")
    }
    
    //判断是否收藏
    
    class  func  creatCell(_ tableView : UITableView) -> FoodDetailCell {
        var cell = tableView.dequeueReusableCell(withIdentifier: "FoodDetailCell")
        if  cell == nil {
            cell = (Bundle.main.loadNibNamed("FoodDetailCell", owner: nil, options: nil))?.first as! FoodDetailCell
        }
        return cell as! FoodDetailCell;
    }
}
